package com.gp.pj.service.impl;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.gp.pj.entity.Dict;
import com.gp.pj.entity.DictItem;
import com.gp.pj.mapper.DictItemMapper;
import com.gp.pj.mapper.DictMapper;
import com.gp.pj.service.DictService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.gp.pj.utils.ResultUtils;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author Chloe
 * @since 2020-12-14
 */
@Service
public class DictServiceImpl extends ServiceImpl<DictMapper, Dict> implements DictService {

    @Resource
    DictMapper dictMapper;

    @Override
    public ResultUtils getDictList() {
        IPage<Dict> page = this.page(new Page<>(), Wrappers.<Dict>lambdaQuery());
        return ResultUtils.success(page);
    }

    @Override
    public String queryDictTextByKey(String code, String key) {
        return dictMapper.queryDictTextByKey(code, key);
    }

    @Override
    public String queryTableDictTextByKey(String code, String text, String table, String key) {
        return dictMapper.queryTableDictTextByKey(code, text, table, key);
    }

}
